//
//  RechargeListCell.m
//  PlayCatchGame
//
//  Created by 流言 on 2018/2/6.
//  Copyright © 2018年 清正. All rights reserved.
//

#import "RechargeListCell.h"


@interface RechargeListCell()

@property (nonatomic, copy)ButtonBlock buttonBlock;

@end


@implementation RechargeListCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

/// 创建cell
+ (instancetype)findCellWithIdentifier:(NSString*)identifier {
    NSArray *cellArray =[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil];
    for (RechargeListCell *cell in cellArray) {
        if ([cell.reuseIdentifier isEqualToString:identifier]) {
            return cell;
        }
    }
    return nil;
}

- (void)setDataDict:(NSDictionary *)dataDict {
    if (dataDict) {
        _dataDict =dataDict;
        
        self.image1View.image =[UIImage imageNamed:dataDict[@"imageName"]];
        self.titleLabel.text =dataDict[@"title"];
        self.moneyLabel.text =[NSString stringWithFormat:@"¥%.2f", [dataDict[@"money"] floatValue]];
    }
}

- (IBAction)buttonClick:(UIButton *)sender {
    if (self.buttonBlock) {
        self.buttonBlock(sender);
    }
}

- (void)didButtonClickBlock:(ButtonBlock)newBlock {
    self.buttonBlock =newBlock;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
